<template>
    <view>
        <!--单选-->
        <u-radio-group v-model="sex" 
        v-if="!formObj.value">
				<u-radio 
               
				v-for="(item, index) in radioList" 
				:key="index" :name="item.name" 
				:disabled="item.disabled"
				@change="radioChange"
				>
					{{ item.name }}
				</u-radio>
		</u-radio-group>

        <view v-else>
            {{sex}}
        </view>
    </view>
</template>


<script>
export default {

    props: {
        formObj: {
            type: Object,
            
        }
    },


    data () {
        return  {

            radioObj: {},
            sex:'',
            radioList: [

            ],
            
        }
    },

    mounted() {
        this.radioObj = this.formObj

        var item = this.radioObj.items
              

        this.sex = this.formObj.value

     
        item.map(item=>this.radioList.push({
            value: item.label_value,
            name: item.label_name,
            disabled: false
        }))
    },
    methods: {

        radioChange(e){

            console.log(e)

        var obj = {
                key: this.radioObj.name,
                value: e
            }
            this.$emit('childFn',obj)

        }

    }
    
}
</script>

<style lang="less" scoped>

</style>